import { useEffect } from "react";
import useStore from "./store";

function App() {
  const { channelList, count, inc, getChannelList } = useStore();
  useEffect(() => {
    // 调用store中的异步获取数据的方法
    getChannelList();
  }, []);
  return (
    <>
      <div>
        {count} <button onClick={inc}>点我加一</button>
      </div>
      <ul>
        {/* 渲染store中的数据 */}
        {channelList.map((item) => (
          <li key={item.id}>{item.name}</li>
        ))}
      </ul>
    </>
  );
}

export default App;
